using AutoUnzip.Core;
using AutoUnzip.Design;
using AutoUnzip.Interfaces;
using Ninject;
using ReactiveUI;

namespace AutoUnzip.ViewModel
{
    public class ViewModelLocator
    {
        private static StandardKernel kernel;

        static ViewModelLocator()
        {
            kernel = new StandardKernel();

            if (DesignModeDetector.IsInDesignMode())
            {
                kernel.Bind<IFileService>().To<FileServiceDesign>();
                kernel.Bind<IZipSerivce>().To<ZipSerivce>();
            }
            else
            {
                kernel.Bind<IFileService>().To<FileService>();
                kernel.Bind<IZipSerivce>().To<ZipSerivce>();
            }

            kernel.Bind<MainViewModel>().ToSelf();
        }

        public MainViewModel Main
        {
            get
            {
                return kernel.Get<MainViewModel>();
            }
        }
    }
}